﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ui.data
{
    public class DataTableColumn
    {
        private HorizontalAlignment alignment;

        public HorizontalAlignment Alignment
        {
            get { return alignment; }
            set { alignment = value; }
        }
        private string text;

        public string Text
        {
            get { return text; }
            set { text = value; }
        }
        private string expression;

        private string format;

        private Type _type; /* 0:numeric 1:string */

        public Type DataType
        {
            get { return _type; }
            set { _type = value; }
        }

        public string Expression
        {
            get { return expression; }
            set { expression = value; }
        }
    }

    public class DataTable
    {
        /* column header */
        private LinkedList<DataTableColumn> _headers;
        /* values row */
        private LinkedList<Dictionary<string, object>> _rows;

        public LinkedList<Dictionary<string, object>> Rows
        {
            get { return _rows; }
            set { _rows = value; }
        }

        public LinkedList<DataTableColumn> Headers
        {
            get { return _headers; }
            set { _headers = value; }
        }

        public object getValue(int col, int row)
        {
            if (col > _headers.Count || row > _rows.Count)
                throw new SystemException("Index OverFlow!");
            //if type is numeric call expression parser
            //else
            //initial expression if need
            //prepare variable for it
            //caculate new value
            return null;
        }

    }



}
